package com.sailfish.springbootdemo.dao.db4;

import com.sailfish.springbootdemo.common.DB4TableName;
import com.sailfish.springbootdemo.pojo.db4.Operate;
import com.sailfish.springbootdemo.pojo.db4.OperateLog;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.type.JdbcType;

import java.util.List;

public interface OperateLogDao {

    /**
     * 查询所有
     *
     * @return
     */
    @Results(id = "operateLogResultMap", value = {
            @Result(column = "operate_id", property = "operateId", jdbcType = JdbcType.INTEGER),
            @Result(column = "operate_big_type", property = "operateBigType", jdbcType = JdbcType.INTEGER),
            @Result(column = "operator_id", property = "operatorId", jdbcType = JdbcType.INTEGER),
            @Result(column = "operate_small_type", property = "operateSmallType", jdbcType = JdbcType.VARCHAR),
            @Result(column = "operate_data_type", property = "operateDataType", jdbcType = JdbcType.INTEGER),
            @Result(column = "operate_data_type_notes", property = "operateDataTypeNotes", jdbcType = JdbcType.INTEGER),
            @Result(column = "operate_time", property = "operateTime", jdbcType = JdbcType.DATETIMEOFFSET),
            @Result(column = "nick_name_cn", property = "nickNameCn", jdbcType = JdbcType.VARCHAR),
            @Result(column = "operate_domain_name", property = "operateDomainName", jdbcType = JdbcType.VARCHAR),
            @Result(column = "operate_ip", property = "operateIp", jdbcType = JdbcType.VARCHAR),
            @Result(column = "operate_network_seg", property = "operateNetworkSeg", jdbcType = JdbcType.VARCHAR),
    })

     /**
     * 新增
     *
     * @param operate
     * @return
     */
    @Insert("insert into " + DB4TableName.OPERATE_LOG + "(operate_big_type,operator_id,operate_small_type,operate_data_type,operate_data_type_notes,operate_time,nick_name_cn,operate_domain_name,operate_ip,operate_network_seg) values " +
            "(#{operate.operateBigType},#{operate.operatorId},#{operate.operateSmallType},#{operate.operateDataType},#{operate.operateDataTypeNotes},#{operate.operateTime},#{operate.nickNameCn},#{operate.operateDomainName},#{operate.operateIp},#{operate.operateNetworkSeg})")
    Integer addOperateLog(@Param("operate") OperateLog operate);
}
